#region Usings
using System;
using System.Configuration;
using System.Data.Entity;
#endregion

namespace BK.Model
{
    public class BkDataContext : DbContext
    {
        #region Readonly & Static Fields
        private readonly string _identifieer;
        #endregion

        #region C'tors
        public BkDataContext()
            : this(ConfigurationManager.ConnectionStrings["BookKeeper"].ConnectionString)
        {
            _identifieer = Guid.NewGuid().ToString();
        }

        private BkDataContext(string nameOrConnectionString) : base(nameOrConnectionString)
        {
            Database.SetInitializer(new DropCreateDatabaseIfModelChanges<BkDataContext>());
        }
        #endregion

        #region Instance Properties
        public DbSet<Account> Accounts { get; set; }
        public DbSet<BestExpense> BestExpenses { get; set; }
        public DbSet<BestExpensesFile> BestExpensesFiles { get; set; }
        public DbSet<Category> Categories { get; set; }
        public DbSet<CommonExpense> CommonExpenses { get; set; }
        public DbSet<Currency> Currencies { get; set; }
        public DbSet<FinancistoExpense> FinancistoExpenses { get; set; }
        public DbSet<FinancistoFile> FinancistoFiles { get; set; }

        public string Identifier
        {
            get { return _identifieer; }
        }

        public DbSet<ImportStatus> ImportStatuses { get; set; }
        public DbSet<Payment> Payments { get; set; }
        public DbSet<Role> Roles { get; set; }
        public DbSet<Target> Targets { get; set; }
        public DbSet<User> Users { get; set; }
        #endregion
    }
}